package com.tm.d3_exception;
/**
 * 2024/6/2 Cjj 掌握自定义异常,以及异常的作用
 */
public class  Exceptiontest2 {
    public static void main(String[] args) {
        try {
            cage(100);
        } catch (java.lang.Exception e) {
            throw new RuntimeException(e);

        }


    }
    public static void cage(int age){
        if(age>0 && age<120){
            System.out.println("年龄保存成功: "+age);
        }else {
         throw  new AgellegalRuntimeException("/age is illegal,your age is"+age);
        }
    }


}
